<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Temu数据分析平台</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="./res/layui/css/layui.css" rel="stylesheet">
  <script>
    if(!/^http(s*):\/\//.test(location.href)){
      alert('请通过 Temu 访问');
    }
  </script>
</head>
<body>
  <div id="LAY_app"></div>
  <script src="./res/layui/layui.js"></script>
  <script>
  layui.config({
    base: 'res/', // 静态资源所在路径
    version: '2.2.0'
  }).use('index', function(){
    var layer = layui.layer;
    var admin = layui.admin;
    var setter = layui.setter;
  var router = layui.router()
            var search = router.search;
    layui.data(setter.tableName, {
      key: setter.request.tokenName
      ,value: ''
    });
    // 提示语
    layer.ready(function(){
      const params = new URLSearchParams(window.location.search);
      const userId = params.get('userId');
      const cookie = params.get('cookie');
      admin.req({
        url: '/temu/login' //实际使用请改成服务端真实接口
        ,data: {userId:userId,cookie:cookie}
        ,method:'post'
        ,done: function(res){
            console.log("token"+res.data);
          // 请求成功后，写入 access_token
          layui.data(setter.tableName, {
            key: setter.request.tokenName
            ,value: res.data
          });
          //登入成功的提示与跳转
          layer.msg('登录成功', {
            offset: '15px'
            ,icon: 1
            ,time: 1000
          }, function(){
            // location.hash = search.redirect ? decodeURIComponent(search.redirect) : '/';
          });
        }
      });

      // admin.popup({
      //   content: '单页面版默认未开启“标签页”功能，实际使用时，你可以自定义是否开启'
      //   ,area: '300px'
      //   ,shade: false
      //   ,offset: 't'
      // });
    });
  });
  </script>
</body>
</html>


